<cfset BASE = CreateObject("component", "cfc.base") / >
<cfset statusQueries = CreateObject("component", "cfc.statusQueries") />
<cfset baseQueries = CreateObject("component", "cfc.queries") />

<cfoutput>
<!---HTML header, css links, js links, and page title--->
#BASE.htmlHeader(
    "", <!---JS links--->
    "", <!---CSS links--->
    "Badge Creation Report", <!---Page Title--->
    "Status" <!---Active Nav Link--->
)#
<!---HTML header, css links, js links, and page title--->
</cfoutput>



<cfif Session.bolAuth EQ True and (Session.strAuthType EQ Session.IT or Session.strAuthType EQ Session.HR)>   
    
    <cfset qryGetStep4Waiting = statusQueries.funcGetSCFStepWaiting(5) />
        
    <!--- <body onload="window.print();"> --->

			<style type="text/css" media="print">
			page {
			  size:landscape;
			}
			</style>
            <div class="post">
                <div class="entry">
                	<div clase="report">
                		<h1 class="title">Badge Creation Report</h1>
	<cfoutput>	
        <cfset intX = 1>
        <cfset GAP = 25>
        <cfif qryGetStep4Waiting.recordcount GT 0>
            <table width = 100%>
                <tr>
                    <td>&nbsp;</td> 
                </tr>
                <tr>
                    <td width =15%>&nbsp;</td> 
                    <td valign="bottom"><u>##</u></td> 
                    <td width=#GAP#>&nbsp;</td> 
                    <td valign="bottom">
                        <strong><u>Name</u></strong>
                    </td>
                    <td width=#GAP#>&nbsp;</td> 
                    <td valign="bottom">
                        <strong><u>Job Title</u></strong>
                    </td>
                    <td width=#GAP#>&nbsp;</td> 
                    <td valign="bottom">
                        <strong><u>Department</u></strong>
                    </td>
                    <td width =15%>&nbsp;</td> 
                </tr>
                <cfloop query="qryGetStep4Waiting">     
                    <cfset intStepID = ID>                             
                    <cfset strEmpName =  Name>                   	
                    <cfquery name="qryGetEmpInfo" datasource="#Session.DataSource#">
                        scf_GetEmpInfoByStep #intStepID#
                    </cfquery>
                    <cfset intEmpID = qryGetEmpInfo.ID>
                    <cfquery name="qryGetPositionInfo" datasource="#Session.DataSourceWFCDB#">
                        Select C.PositionIDNo, PositionCode, PositionCodeDescription
                        From tPosition_Codes C
                            Inner Join (
                                Select PositionIDNo, Max(PositionToEffectDate) as LastFilled
                                From tPerson_Positions
                                Group by PositionIDNo
                                /*Having Max(PositionToEffectDate) < '1/1/3000'*/) X On X.PositionIDNo = C.PositionIDNo	
                        Where C.PositionIdNo = #qryGetEmpInfo.PositionID#
                    </cfquery>
                    <cfset strJobTitle = qryGetPositionInfo.PositionCodeDescription>                                
                                                   
                    <cfquery name="qryGetDept" datasource="#Session.DataSourceWFCDB#">
                        Select OrganizationDescription + ' (' + OrganizationCode + ')' as Org, OrganizationDescription
                        From tOrganizations
                        Where OrgCodeIDNo = #qryGetEmpInfo.DeptID#	
                    </cfquery> 
                    <cfset strDept = qryGetDept.OrganizationDescription>
                <tr>
                    <td>&nbsp;</td> 
                    <td>#intX#)</td> 
                    <td>&nbsp;</td> 
                    <td valign="bottom">
                        #strEmpName#
                    </td>
                    <td>&nbsp;</td> 
                    <td valign="bottom">
                        #strJobTitle#
                    </td>
                    <td>&nbsp;</td> 
                    <td valign="bottom">
                        #strDept#
                    </td> 
                </tr>
                <tr>
                    <td>&nbsp;</td> 
                </tr>
                    <cfset intX += 1>
                </cfloop>   
                
            </table>
        <cfelse>
            <span class="error">At the present time, there are not any employees staged for entry to IVIS.</span>
        </cfif>
        
    </cfoutput>
    
    			</div>
    		</div>
    	</div>
    
	</body>
    
<cfelse>
	<cfinclude template="Denied.cfm">
    
</cfif>

<cfoutput>
<!---HTML footer, closes html and body tags.  Any footer info goes here--->
#BASE.htmlFooter()#
<!---HTML footer, closes html and body tags.  Any footer info goes here--->
</cfoutput>
